/**
 * 励志谏言管理
 * @project readnote
 * @author huxh
 * @date 2012-5-15
 **/
package com.readnote.admin.expostulation;

import com.cr.backbone.action.AppBaseActionSupport;
import com.readnote.expostulation.model.Expostulation;
import com.readnote.expostulation.service.ExpostulationService;

public class ExpostulationManageAction extends AppBaseActionSupport{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1179031234511250745L;
	
	private Long[] ids;//数据更新主键集合
	private Expostulation expostulation;

	
	private ExpostulationService expostulationService;
	
	/***
	 * 查看 expostulation list
	 */
	public String index(){
		page = expostulationService.getPage(getQuery(), page);
		return INDEX;
	}
	
	/***
	 * 查看 expostulation list
	 */
	public String query(){
		page = expostulationService.getPage(getQuery(), page);
		return INDEX;
	}
	
	/**
	 * 进入expostulation更新页面
	 */
	public String input(){
		if(ids!=null && ids.length!=0)
			expostulation = expostulationService.get(ids[0]);
		return INPUT;
	}
	
	/**
	 * 保存（新建\更新）
	 * @methodDescribe 
	 * @return
	 * @author xianghua.hu
	 * @date 2012-5-15
	 */
	public String save(){
		if(expostulation==null || expostulation.isNullRow()){
			expostulationService.save(expostulation);
		}else{
			Expostulation _expostulation = expostulationService.get( expostulation.getId() );
			
			expostulationService.update(_expostulation);
		}
		return SUCCESS;
	}

	public Long[] getIds() {
		return ids;
	}

	public void setIds(Long[] ids) {
		this.ids = ids;
	}

	public Expostulation getExpostulation() {
		return expostulation;
	}

	public void setExpostulation(Expostulation expostulation) {
		this.expostulation = expostulation;
	}

	public ExpostulationService getExpostulationService() {
		return expostulationService;
	}

	public void setExpostulationService(ExpostulationService expostulationService) {
		this.expostulationService = expostulationService;
	}
	
	

	
}
